<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de_DE" lang="de_DE">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>InfTree xref</title>
<link type="text/css" rel="stylesheet" href="../../../../../../stylesheet.css" />
</head>
<body>
<div id="overview"><a href="../../../../../../../api/org/jboss/netty/util/internal/jzlib/InfTree.html">View Javadoc</a></div><pre>

<a class="jxr_linenumber" name="1" href="#1">1</a>   <em class="jxr_comment">/*</em>
<a class="jxr_linenumber" name="2" href="#2">2</a>   <em class="jxr_comment"> * Copyright 2012 The Netty Project</em>
<a class="jxr_linenumber" name="3" href="#3">3</a>   <em class="jxr_comment"> *</em>
<a class="jxr_linenumber" name="4" href="#4">4</a>   <em class="jxr_comment"> * The Netty Project licenses this file to you under the Apache License,</em>
<a class="jxr_linenumber" name="5" href="#5">5</a>   <em class="jxr_comment"> * version 2.0 (the "License"); you may not use this file except in compliance</em>
<a class="jxr_linenumber" name="6" href="#6">6</a>   <em class="jxr_comment"> * with the License. You may obtain a copy of the License at:</em>
<a class="jxr_linenumber" name="7" href="#7">7</a>   <em class="jxr_comment"> *</em>
<a class="jxr_linenumber" name="8" href="#8">8</a>   <em class="jxr_comment"> *   <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
<a class="jxr_linenumber" name="9" href="#9">9</a>   <em class="jxr_comment"> *</em>
<a class="jxr_linenumber" name="10" href="#10">10</a>  <em class="jxr_comment"> * Unless required by applicable law or agreed to in writing, software</em>
<a class="jxr_linenumber" name="11" href="#11">11</a>  <em class="jxr_comment"> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT</em>
<a class="jxr_linenumber" name="12" href="#12">12</a>  <em class="jxr_comment"> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the</em>
<a class="jxr_linenumber" name="13" href="#13">13</a>  <em class="jxr_comment"> * License for the specific language governing permissions and limitations</em>
<a class="jxr_linenumber" name="14" href="#14">14</a>  <em class="jxr_comment"> * under the License.</em>
<a class="jxr_linenumber" name="15" href="#15">15</a>  <em class="jxr_comment"> */</em>
<a class="jxr_linenumber" name="16" href="#16">16</a>  <em class="jxr_comment">/*</em>
<a class="jxr_linenumber" name="17" href="#17">17</a>  <em class="jxr_comment">Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.</em>
<a class="jxr_linenumber" name="18" href="#18">18</a>  
<a class="jxr_linenumber" name="19" href="#19">19</a>  <em class="jxr_comment">Redistribution and use in source and binary forms, with or without</em>
<a class="jxr_linenumber" name="20" href="#20">20</a>  <em class="jxr_comment">modification, are permitted provided that the following conditions are met:</em>
<a class="jxr_linenumber" name="21" href="#21">21</a>  
<a class="jxr_linenumber" name="22" href="#22">22</a>  <em class="jxr_comment">  1. Redistributions of source code must retain the above copyright notice,</em>
<a class="jxr_linenumber" name="23" href="#23">23</a>  <em class="jxr_comment">     this list of conditions and the following disclaimer.</em>
<a class="jxr_linenumber" name="24" href="#24">24</a>  
<a class="jxr_linenumber" name="25" href="#25">25</a>  <em class="jxr_comment">  2. Redistributions in binary form must reproduce the above copyright</em>
<a class="jxr_linenumber" name="26" href="#26">26</a>  <em class="jxr_comment">     notice, this list of conditions and the following disclaimer in</em>
<a class="jxr_linenumber" name="27" href="#27">27</a>  <em class="jxr_comment">     the documentation and/or other materials provided with the distribution.</em>
<a class="jxr_linenumber" name="28" href="#28">28</a>  
<a class="jxr_linenumber" name="29" href="#29">29</a>  <em class="jxr_comment">  3. The names of the authors may not be used to endorse or promote products</em>
<a class="jxr_linenumber" name="30" href="#30">30</a>  <em class="jxr_comment">     derived from this software without specific prior written permission.</em>
<a class="jxr_linenumber" name="31" href="#31">31</a>  
<a class="jxr_linenumber" name="32" href="#32">32</a>  <em class="jxr_comment">THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,</em>
<a class="jxr_linenumber" name="33" href="#33">33</a>  <em class="jxr_comment">INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND</em>
<a class="jxr_linenumber" name="34" href="#34">34</a>  <em class="jxr_comment">FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,</em>
<a class="jxr_linenumber" name="35" href="#35">35</a>  <em class="jxr_comment">INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,</em>
<a class="jxr_linenumber" name="36" href="#36">36</a>  <em class="jxr_comment">INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</em>
<a class="jxr_linenumber" name="37" href="#37">37</a>  <em class="jxr_comment">LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,</em>
<a class="jxr_linenumber" name="38" href="#38">38</a>  <em class="jxr_comment">OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</em>
<a class="jxr_linenumber" name="39" href="#39">39</a>  <em class="jxr_comment">LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING</em>
<a class="jxr_linenumber" name="40" href="#40">40</a>  <em class="jxr_comment">NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,</em>
<a class="jxr_linenumber" name="41" href="#41">41</a>  <em class="jxr_comment">EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</em>
<a class="jxr_linenumber" name="42" href="#42">42</a>  <em class="jxr_comment"> */</em>
<a class="jxr_linenumber" name="43" href="#43">43</a>  <em class="jxr_comment">/*</em>
<a class="jxr_linenumber" name="44" href="#44">44</a>  <em class="jxr_comment"> * This program is based on zlib-1.1.3, so all credit should go authors</em>
<a class="jxr_linenumber" name="45" href="#45">45</a>  <em class="jxr_comment"> * Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)</em>
<a class="jxr_linenumber" name="46" href="#46">46</a>  <em class="jxr_comment"> * and contributors of zlib.</em>
<a class="jxr_linenumber" name="47" href="#47">47</a>  <em class="jxr_comment"> */</em>
<a class="jxr_linenumber" name="48" href="#48">48</a>  <strong class="jxr_keyword">package</strong> org.jboss.netty.util.internal.jzlib;
<a class="jxr_linenumber" name="49" href="#49">49</a>  
<a class="jxr_linenumber" name="50" href="#50">50</a>  <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/jboss/netty/util/internal/jzlib/InfTree.html">InfTree</a> {
<a class="jxr_linenumber" name="51" href="#51">51</a>  
<a class="jxr_linenumber" name="52" href="#52">52</a>      <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> fixed_bl = 9;
<a class="jxr_linenumber" name="53" href="#53">53</a>      <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> fixed_bd = 5;
<a class="jxr_linenumber" name="54" href="#54">54</a>  
<a class="jxr_linenumber" name="55" href="#55">55</a>      <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] fixed_tl = { 96, 7, 256, 0, 8, 80, 0, 8, 16, 84, 8, 115,
<a class="jxr_linenumber" name="56" href="#56">56</a>              82, 7, 31, 0, 8, 112, 0, 8, 48, 0, 9, 192, 80, 7, 10, 0, 8, 96, 0,
<a class="jxr_linenumber" name="57" href="#57">57</a>              8, 32, 0, 9, 160, 0, 8, 0, 0, 8, 128, 0, 8, 64, 0, 9, 224, 80, 7,
<a class="jxr_linenumber" name="58" href="#58">58</a>              6, 0, 8, 88, 0, 8, 24, 0, 9, 144, 83, 7, 59, 0, 8, 120, 0, 8, 56,
<a class="jxr_linenumber" name="59" href="#59">59</a>              0, 9, 208, 81, 7, 17, 0, 8, 104, 0, 8, 40, 0, 9, 176, 0, 8, 8, 0,
<a class="jxr_linenumber" name="60" href="#60">60</a>              8, 136, 0, 8, 72, 0, 9, 240, 80, 7, 4, 0, 8, 84, 0, 8, 20, 85, 8,
<a class="jxr_linenumber" name="61" href="#61">61</a>              227, 83, 7, 43, 0, 8, 116, 0, 8, 52, 0, 9, 200, 81, 7, 13, 0, 8,
<a class="jxr_linenumber" name="62" href="#62">62</a>              100, 0, 8, 36, 0, 9, 168, 0, 8, 4, 0, 8, 132, 0, 8, 68, 0, 9, 232,
<a class="jxr_linenumber" name="63" href="#63">63</a>              80, 7, 8, 0, 8, 92, 0, 8, 28, 0, 9, 152, 84, 7, 83, 0, 8, 124, 0,
<a class="jxr_linenumber" name="64" href="#64">64</a>              8, 60, 0, 9, 216, 82, 7, 23, 0, 8, 108, 0, 8, 44, 0, 9, 184, 0, 8,
<a class="jxr_linenumber" name="65" href="#65">65</a>              12, 0, 8, 140, 0, 8, 76, 0, 9, 248, 80, 7, 3, 0, 8, 82, 0, 8, 18,
<a class="jxr_linenumber" name="66" href="#66">66</a>              85, 8, 163, 83, 7, 35, 0, 8, 114, 0, 8, 50, 0, 9, 196, 81, 7, 11,
<a class="jxr_linenumber" name="67" href="#67">67</a>              0, 8, 98, 0, 8, 34, 0, 9, 164, 0, 8, 2, 0, 8, 130, 0, 8, 66, 0, 9,
<a class="jxr_linenumber" name="68" href="#68">68</a>              228, 80, 7, 7, 0, 8, 90, 0, 8, 26, 0, 9, 148, 84, 7, 67, 0, 8, 122,
<a class="jxr_linenumber" name="69" href="#69">69</a>              0, 8, 58, 0, 9, 212, 82, 7, 19, 0, 8, 106, 0, 8, 42, 0, 9, 180, 0,
<a class="jxr_linenumber" name="70" href="#70">70</a>              8, 10, 0, 8, 138, 0, 8, 74, 0, 9, 244, 80, 7, 5, 0, 8, 86, 0, 8,
<a class="jxr_linenumber" name="71" href="#71">71</a>              22, 192, 8, 0, 83, 7, 51, 0, 8, 118, 0, 8, 54, 0, 9, 204, 81, 7,
<a class="jxr_linenumber" name="72" href="#72">72</a>              15, 0, 8, 102, 0, 8, 38, 0, 9, 172, 0, 8, 6, 0, 8, 134, 0, 8, 70,
<a class="jxr_linenumber" name="73" href="#73">73</a>              0, 9, 236, 80, 7, 9, 0, 8, 94, 0, 8, 30, 0, 9, 156, 84, 7, 99, 0,
<a class="jxr_linenumber" name="74" href="#74">74</a>              8, 126, 0, 8, 62, 0, 9, 220, 82, 7, 27, 0, 8, 110, 0, 8, 46, 0, 9,
<a class="jxr_linenumber" name="75" href="#75">75</a>              188, 0, 8, 14, 0, 8, 142, 0, 8, 78, 0, 9, 252, 96, 7, 256, 0, 8,
<a class="jxr_linenumber" name="76" href="#76">76</a>              81, 0, 8, 17, 85, 8, 131, 82, 7, 31, 0, 8, 113, 0, 8, 49, 0, 9,
<a class="jxr_linenumber" name="77" href="#77">77</a>              194, 80, 7, 10, 0, 8, 97, 0, 8, 33, 0, 9, 162, 0, 8, 1, 0, 8, 129,
<a class="jxr_linenumber" name="78" href="#78">78</a>              0, 8, 65, 0, 9, 226, 80, 7, 6, 0, 8, 89, 0, 8, 25, 0, 9, 146, 83,
<a class="jxr_linenumber" name="79" href="#79">79</a>              7, 59, 0, 8, 121, 0, 8, 57, 0, 9, 210, 81, 7, 17, 0, 8, 105, 0, 8,
<a class="jxr_linenumber" name="80" href="#80">80</a>              41, 0, 9, 178, 0, 8, 9, 0, 8, 137, 0, 8, 73, 0, 9, 242, 80, 7, 4,
<a class="jxr_linenumber" name="81" href="#81">81</a>              0, 8, 85, 0, 8, 21, 80, 8, 258, 83, 7, 43, 0, 8, 117, 0, 8, 53, 0,
<a class="jxr_linenumber" name="82" href="#82">82</a>              9, 202, 81, 7, 13, 0, 8, 101, 0, 8, 37, 0, 9, 170, 0, 8, 5, 0, 8,
<a class="jxr_linenumber" name="83" href="#83">83</a>              133, 0, 8, 69, 0, 9, 234, 80, 7, 8, 0, 8, 93, 0, 8, 29, 0, 9, 154,
<a class="jxr_linenumber" name="84" href="#84">84</a>              84, 7, 83, 0, 8, 125, 0, 8, 61, 0, 9, 218, 82, 7, 23, 0, 8, 109, 0,
<a class="jxr_linenumber" name="85" href="#85">85</a>              8, 45, 0, 9, 186, 0, 8, 13, 0, 8, 141, 0, 8, 77, 0, 9, 250, 80, 7,
<a class="jxr_linenumber" name="86" href="#86">86</a>              3, 0, 8, 83, 0, 8, 19, 85, 8, 195, 83, 7, 35, 0, 8, 115, 0, 8, 51,
<a class="jxr_linenumber" name="87" href="#87">87</a>              0, 9, 198, 81, 7, 11, 0, 8, 99, 0, 8, 35, 0, 9, 166, 0, 8, 3, 0, 8,
<a class="jxr_linenumber" name="88" href="#88">88</a>              131, 0, 8, 67, 0, 9, 230, 80, 7, 7, 0, 8, 91, 0, 8, 27, 0, 9, 150,
<a class="jxr_linenumber" name="89" href="#89">89</a>              84, 7, 67, 0, 8, 123, 0, 8, 59, 0, 9, 214, 82, 7, 19, 0, 8, 107, 0,
<a class="jxr_linenumber" name="90" href="#90">90</a>              8, 43, 0, 9, 182, 0, 8, 11, 0, 8, 139, 0, 8, 75, 0, 9, 246, 80, 7,
<a class="jxr_linenumber" name="91" href="#91">91</a>              5, 0, 8, 87, 0, 8, 23, 192, 8, 0, 83, 7, 51, 0, 8, 119, 0, 8, 55,
<a class="jxr_linenumber" name="92" href="#92">92</a>              0, 9, 206, 81, 7, 15, 0, 8, 103, 0, 8, 39, 0, 9, 174, 0, 8, 7, 0,
<a class="jxr_linenumber" name="93" href="#93">93</a>              8, 135, 0, 8, 71, 0, 9, 238, 80, 7, 9, 0, 8, 95, 0, 8, 31, 0, 9,
<a class="jxr_linenumber" name="94" href="#94">94</a>              158, 84, 7, 99, 0, 8, 127, 0, 8, 63, 0, 9, 222, 82, 7, 27, 0, 8,
<a class="jxr_linenumber" name="95" href="#95">95</a>              111, 0, 8, 47, 0, 9, 190, 0, 8, 15, 0, 8, 143, 0, 8, 79, 0, 9, 254,
<a class="jxr_linenumber" name="96" href="#96">96</a>              96, 7, 256, 0, 8, 80, 0, 8, 16, 84, 8, 115, 82, 7, 31, 0, 8, 112,
<a class="jxr_linenumber" name="97" href="#97">97</a>              0, 8, 48, 0, 9, 193,
<a class="jxr_linenumber" name="98" href="#98">98</a>              80, 7, 10, 0, 8, 96, 0, 8, 32, 0, 9, 161, 0, 8, 0, 0, 8, 128, 0, 8,
<a class="jxr_linenumber" name="99" href="#99">99</a>              64, 0, 9, 225, 80, 7, 6, 0, 8, 88, 0, 8, 24, 0, 9, 145, 83, 7, 59,
<a class="jxr_linenumber" name="100" href="#100">100</a>             0, 8, 120, 0, 8, 56, 0, 9, 209, 81, 7, 17, 0, 8, 104, 0, 8, 40, 0,
<a class="jxr_linenumber" name="101" href="#101">101</a>             9, 177, 0, 8, 8, 0, 8, 136, 0, 8, 72, 0, 9, 241, 80, 7, 4, 0, 8,
<a class="jxr_linenumber" name="102" href="#102">102</a>             84, 0, 8, 20, 85, 8, 227, 83, 7, 43, 0, 8, 116, 0, 8, 52, 0, 9,
<a class="jxr_linenumber" name="103" href="#103">103</a>             201, 81, 7, 13, 0, 8, 100, 0, 8, 36, 0, 9, 169, 0, 8, 4, 0, 8, 132,
<a class="jxr_linenumber" name="104" href="#104">104</a>             0, 8, 68, 0, 9, 233, 80, 7, 8, 0, 8, 92, 0, 8, 28, 0, 9, 153, 84,
<a class="jxr_linenumber" name="105" href="#105">105</a>             7, 83, 0, 8, 124, 0, 8, 60, 0, 9, 217, 82, 7, 23, 0, 8, 108, 0, 8,
<a class="jxr_linenumber" name="106" href="#106">106</a>             44, 0, 9, 185, 0, 8, 12, 0, 8, 140, 0, 8, 76, 0, 9, 249, 80, 7, 3,
<a class="jxr_linenumber" name="107" href="#107">107</a>             0, 8, 82, 0, 8, 18, 85, 8, 163, 83, 7, 35, 0, 8, 114, 0, 8, 50, 0,
<a class="jxr_linenumber" name="108" href="#108">108</a>             9, 197, 81, 7, 11, 0, 8, 98, 0, 8, 34, 0, 9, 165, 0, 8, 2, 0, 8,
<a class="jxr_linenumber" name="109" href="#109">109</a>             130, 0, 8, 66, 0, 9, 229, 80, 7, 7, 0, 8, 90, 0, 8, 26, 0, 9, 149,
<a class="jxr_linenumber" name="110" href="#110">110</a>             84, 7, 67, 0, 8, 122, 0, 8, 58, 0, 9, 213, 82, 7, 19, 0, 8, 106, 0,
<a class="jxr_linenumber" name="111" href="#111">111</a>             8, 42, 0, 9, 181, 0, 8, 10, 0, 8, 138, 0, 8, 74, 0, 9, 245, 80, 7,
<a class="jxr_linenumber" name="112" href="#112">112</a>             5, 0, 8, 86, 0, 8, 22, 192, 8, 0, 83, 7, 51, 0, 8, 118, 0, 8, 54,
<a class="jxr_linenumber" name="113" href="#113">113</a>             0, 9, 205, 81, 7, 15, 0, 8, 102, 0, 8, 38, 0, 9, 173, 0, 8, 6, 0,
<a class="jxr_linenumber" name="114" href="#114">114</a>             8, 134, 0, 8, 70, 0, 9, 237, 80, 7, 9, 0, 8, 94, 0, 8, 30, 0, 9,
<a class="jxr_linenumber" name="115" href="#115">115</a>             157, 84, 7, 99, 0, 8, 126, 0, 8, 62, 0, 9, 221, 82, 7, 27, 0, 8,
<a class="jxr_linenumber" name="116" href="#116">116</a>             110, 0, 8, 46, 0, 9, 189, 0, 8, 14, 0, 8, 142, 0, 8, 78, 0, 9, 253,
<a class="jxr_linenumber" name="117" href="#117">117</a>             96, 7, 256, 0, 8, 81, 0, 8, 17, 85, 8, 131, 82, 7, 31, 0, 8, 113,
<a class="jxr_linenumber" name="118" href="#118">118</a>             0, 8, 49, 0, 9, 195, 80, 7, 10, 0, 8, 97, 0, 8, 33, 0, 9, 163, 0,
<a class="jxr_linenumber" name="119" href="#119">119</a>             8, 1, 0, 8, 129, 0, 8, 65, 0, 9, 227, 80, 7, 6, 0, 8, 89, 0, 8, 25,
<a class="jxr_linenumber" name="120" href="#120">120</a>             0, 9, 147, 83, 7, 59, 0, 8, 121, 0, 8, 57, 0, 9, 211, 81, 7, 17, 0,
<a class="jxr_linenumber" name="121" href="#121">121</a>             8, 105, 0, 8, 41, 0, 9, 179, 0, 8, 9, 0, 8, 137, 0, 8, 73, 0, 9,
<a class="jxr_linenumber" name="122" href="#122">122</a>             243, 80, 7, 4, 0, 8, 85, 0, 8, 21, 80, 8, 258, 83, 7, 43, 0, 8,
<a class="jxr_linenumber" name="123" href="#123">123</a>             117, 0, 8, 53, 0, 9, 203, 81, 7, 13, 0, 8, 101, 0, 8, 37, 0, 9,
<a class="jxr_linenumber" name="124" href="#124">124</a>             171, 0, 8, 5, 0, 8, 133, 0, 8, 69, 0, 9, 235, 80, 7, 8, 0, 8, 93,
<a class="jxr_linenumber" name="125" href="#125">125</a>             0, 8, 29, 0, 9, 155, 84, 7, 83, 0, 8, 125, 0, 8, 61, 0, 9, 219, 82,
<a class="jxr_linenumber" name="126" href="#126">126</a>             7, 23, 0, 8, 109, 0, 8, 45, 0, 9, 187, 0, 8, 13, 0, 8, 141, 0, 8,
<a class="jxr_linenumber" name="127" href="#127">127</a>             77, 0, 9, 251, 80, 7, 3, 0, 8, 83, 0, 8, 19, 85, 8, 195, 83, 7, 35,
<a class="jxr_linenumber" name="128" href="#128">128</a>             0, 8, 115, 0, 8, 51, 0, 9, 199, 81, 7, 11, 0, 8, 99, 0, 8, 35, 0,
<a class="jxr_linenumber" name="129" href="#129">129</a>             9, 167, 0, 8, 3, 0, 8, 131, 0, 8, 67, 0, 9, 231, 80, 7, 7, 0, 8,
<a class="jxr_linenumber" name="130" href="#130">130</a>             91, 0, 8, 27, 0, 9, 151, 84, 7, 67, 0, 8, 123, 0, 8, 59, 0, 9, 215,
<a class="jxr_linenumber" name="131" href="#131">131</a>             82, 7, 19, 0, 8, 107, 0, 8, 43, 0, 9, 183, 0, 8, 11, 0, 8, 139, 0,
<a class="jxr_linenumber" name="132" href="#132">132</a>             8, 75, 0, 9, 247, 80, 7, 5, 0, 8, 87, 0, 8, 23, 192, 8, 0, 83, 7,
<a class="jxr_linenumber" name="133" href="#133">133</a>             51, 0, 8, 119, 0, 8, 55, 0, 9, 207, 81, 7, 15, 0, 8, 103, 0, 8, 39,
<a class="jxr_linenumber" name="134" href="#134">134</a>             0, 9, 175, 0, 8, 7, 0, 8, 135, 0, 8, 71, 0, 9, 239, 80, 7, 9, 0, 8,
<a class="jxr_linenumber" name="135" href="#135">135</a>             95, 0, 8, 31, 0, 9, 159, 84, 7, 99, 0, 8, 127, 0, 8, 63, 0, 9, 223,
<a class="jxr_linenumber" name="136" href="#136">136</a>             82, 7, 27, 0, 8, 111, 0, 8, 47, 0, 9, 191, 0, 8, 15, 0, 8, 143, 0,
<a class="jxr_linenumber" name="137" href="#137">137</a>             8, 79, 0, 9, 255 };
<a class="jxr_linenumber" name="138" href="#138">138</a> 
<a class="jxr_linenumber" name="139" href="#139">139</a>     <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] fixed_td = { 80, 5, 1, 87, 5, 257, 83, 5, 17, 91, 5,
<a class="jxr_linenumber" name="140" href="#140">140</a>             4097, 81, 5, 5, 89, 5, 1025, 85, 5, 65, 93, 5, 16385, 80, 5, 3, 88,
<a class="jxr_linenumber" name="141" href="#141">141</a>             5, 513, 84, 5, 33, 92, 5, 8193, 82, 5, 9, 90, 5, 2049, 86, 5, 129,
<a class="jxr_linenumber" name="142" href="#142">142</a>             192, 5, 24577, 80, 5, 2, 87, 5, 385, 83, 5, 25, 91, 5, 6145, 81, 5,
<a class="jxr_linenumber" name="143" href="#143">143</a>             7, 89, 5, 1537, 85, 5, 97, 93, 5, 24577, 80, 5, 4, 88, 5, 769, 84,
<a class="jxr_linenumber" name="144" href="#144">144</a>             5, 49, 92, 5, 12289, 82, 5, 13, 90, 5, 3073, 86, 5, 193, 192, 5,
<a class="jxr_linenumber" name="145" href="#145">145</a>             24577 };
<a class="jxr_linenumber" name="146" href="#146">146</a> 
<a class="jxr_linenumber" name="147" href="#147">147</a>     <em class="jxr_comment">// Tables for deflate from PKZIP's appnote.txt.</em>
<a class="jxr_linenumber" name="148" href="#148">148</a>     <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] cplens = { <em class="jxr_comment">// Copy lengths for literal codes 257..285</em>
<a class="jxr_linenumber" name="149" href="#149">149</a>     3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
<a class="jxr_linenumber" name="150" href="#150">150</a>             67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 };
<a class="jxr_linenumber" name="151" href="#151">151</a> 
<a class="jxr_linenumber" name="152" href="#152">152</a>     <em class="jxr_comment">// see note #13 above about 258</em>
<a class="jxr_linenumber" name="153" href="#153">153</a>     <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] cplext = { <em class="jxr_comment">// Extra bits for literal codes 257..285</em>
<a class="jxr_linenumber" name="154" href="#154">154</a>     0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5,
<a class="jxr_linenumber" name="155" href="#155">155</a>             5, 5, 5, 0, 112, 112 <em class="jxr_comment">// 112==invalid</em>
<a class="jxr_linenumber" name="156" href="#156">156</a>     };
<a class="jxr_linenumber" name="157" href="#157">157</a> 
<a class="jxr_linenumber" name="158" href="#158">158</a>     <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] cpdist = { <em class="jxr_comment">// Copy offsets for distance codes 0..29</em>
<a class="jxr_linenumber" name="159" href="#159">159</a>     1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513,
<a class="jxr_linenumber" name="160" href="#160">160</a>             769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 };
<a class="jxr_linenumber" name="161" href="#161">161</a> 
<a class="jxr_linenumber" name="162" href="#162">162</a>     <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong>[] cpdext = { <em class="jxr_comment">// Extra bits for distance codes</em>
<a class="jxr_linenumber" name="163" href="#163">163</a>     0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10,
<a class="jxr_linenumber" name="164" href="#164">164</a>             11, 11, 12, 12, 13, 13 };
<a class="jxr_linenumber" name="165" href="#165">165</a> 
<a class="jxr_linenumber" name="166" href="#166">166</a>     <em class="jxr_comment">// If BMAX needs to be larger than 16, then h and x[] should be uLong.</em>
<a class="jxr_linenumber" name="167" href="#167">167</a>     <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> BMAX = 15; <em class="jxr_comment">// maximum bit length of any code</em>
<a class="jxr_linenumber" name="168" href="#168">168</a> 
<a class="jxr_linenumber" name="169" href="#169">169</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong>[] hn; <em class="jxr_comment">// hufts used in space</em>
<a class="jxr_linenumber" name="170" href="#170">170</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong>[] v;  <em class="jxr_comment">// work area for huft_build</em>
<a class="jxr_linenumber" name="171" href="#171">171</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong>[] c;  <em class="jxr_comment">// bit length count table</em>
<a class="jxr_linenumber" name="172" href="#172">172</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong>[] r;  <em class="jxr_comment">// table entry for structure assignment</em>
<a class="jxr_linenumber" name="173" href="#173">173</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong>[] u;  <em class="jxr_comment">// table stack</em>
<a class="jxr_linenumber" name="174" href="#174">174</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong>[] x;  <em class="jxr_comment">// bit offsets, then code stack</em>
<a class="jxr_linenumber" name="175" href="#175">175</a> 
<a class="jxr_linenumber" name="176" href="#176">176</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> huft_build(<strong class="jxr_keyword">int</strong>[] b, <em class="jxr_comment">// code lengths in bits (all assumed &lt;= BMAX)</em>
<a class="jxr_linenumber" name="177" href="#177">177</a>             <strong class="jxr_keyword">int</strong> bindex, <strong class="jxr_keyword">int</strong> n, <em class="jxr_comment">// number of codes (assumed &lt;= 288)</em>
<a class="jxr_linenumber" name="178" href="#178">178</a>             <strong class="jxr_keyword">int</strong> s, <em class="jxr_comment">// number of simple-valued codes (0..s-1)</em>
<a class="jxr_linenumber" name="179" href="#179">179</a>             <strong class="jxr_keyword">int</strong>[] d, <em class="jxr_comment">// list of base values for non-simple codes</em>
<a class="jxr_linenumber" name="180" href="#180">180</a>             <strong class="jxr_keyword">int</strong>[] e, <em class="jxr_comment">// list of extra bits for non-simple codes</em>
<a class="jxr_linenumber" name="181" href="#181">181</a>             <strong class="jxr_keyword">int</strong>[] t, <em class="jxr_comment">// result: starting table</em>
<a class="jxr_linenumber" name="182" href="#182">182</a>             <strong class="jxr_keyword">int</strong>[] m, <em class="jxr_comment">// maximum lookup bits, returns actual</em>
<a class="jxr_linenumber" name="183" href="#183">183</a>             <strong class="jxr_keyword">int</strong>[] hp, <em class="jxr_comment">// space for trees</em>
<a class="jxr_linenumber" name="184" href="#184">184</a>             <strong class="jxr_keyword">int</strong>[] hn, <em class="jxr_comment">// hufts used in space</em>
<a class="jxr_linenumber" name="185" href="#185">185</a>             <strong class="jxr_keyword">int</strong>[] v <em class="jxr_comment">// working area: values in order of bit length</em>
<a class="jxr_linenumber" name="186" href="#186">186</a>     ) {
<a class="jxr_linenumber" name="187" href="#187">187</a>         <em class="jxr_comment">// Given a list of code lengths and a maximum table size, make a set of</em>
<a class="jxr_linenumber" name="188" href="#188">188</a>         <em class="jxr_comment">// tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR</em>
<a class="jxr_linenumber" name="189" href="#189">189</a>         <em class="jxr_comment">// if the given code set is incomplete (the tables are still built in this</em>
<a class="jxr_linenumber" name="190" href="#190">190</a>         <em class="jxr_comment">// case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of</em>
<a class="jxr_linenumber" name="191" href="#191">191</a>         <em class="jxr_comment">// lengths), or Z_MEM_ERROR if not enough memory.</em>
<a class="jxr_linenumber" name="192" href="#192">192</a> 
<a class="jxr_linenumber" name="193" href="#193">193</a>         <strong class="jxr_keyword">int</strong> a; <em class="jxr_comment">// counter for codes of length k</em>
<a class="jxr_linenumber" name="194" href="#194">194</a>         <strong class="jxr_keyword">int</strong> f; <em class="jxr_comment">// i repeats in table every f entries</em>
<a class="jxr_linenumber" name="195" href="#195">195</a>         <strong class="jxr_keyword">int</strong> g; <em class="jxr_comment">// maximum code length</em>
<a class="jxr_linenumber" name="196" href="#196">196</a>         <strong class="jxr_keyword">int</strong> h; <em class="jxr_comment">// table level</em>
<a class="jxr_linenumber" name="197" href="#197">197</a>         <strong class="jxr_keyword">int</strong> i; <em class="jxr_comment">// counter, current code</em>
<a class="jxr_linenumber" name="198" href="#198">198</a>         <strong class="jxr_keyword">int</strong> j; <em class="jxr_comment">// counter</em>
<a class="jxr_linenumber" name="199" href="#199">199</a>         <strong class="jxr_keyword">int</strong> k; <em class="jxr_comment">// number of bits in current code</em>
<a class="jxr_linenumber" name="200" href="#200">200</a>         <strong class="jxr_keyword">int</strong> l; <em class="jxr_comment">// bits per table (returned in m)</em>
<a class="jxr_linenumber" name="201" href="#201">201</a>         <strong class="jxr_keyword">int</strong> mask; <em class="jxr_comment">// (1 &lt;&lt; w) - 1, to avoid cc -O bug on HP</em>
<a class="jxr_linenumber" name="202" href="#202">202</a>         <strong class="jxr_keyword">int</strong> p; <em class="jxr_comment">// pointer into c[], b[], or v[]</em>
<a class="jxr_linenumber" name="203" href="#203">203</a>         <strong class="jxr_keyword">int</strong> q; <em class="jxr_comment">// points to current table</em>
<a class="jxr_linenumber" name="204" href="#204">204</a>         <strong class="jxr_keyword">int</strong> w; <em class="jxr_comment">// bits before this table == (l * h)</em>
<a class="jxr_linenumber" name="205" href="#205">205</a>         <strong class="jxr_keyword">int</strong> xp; <em class="jxr_comment">// pointer into x</em>
<a class="jxr_linenumber" name="206" href="#206">206</a>         <strong class="jxr_keyword">int</strong> y; <em class="jxr_comment">// number of dummy codes added</em>
<a class="jxr_linenumber" name="207" href="#207">207</a>         <strong class="jxr_keyword">int</strong> z; <em class="jxr_comment">// number of entries in current table</em>
<a class="jxr_linenumber" name="208" href="#208">208</a> 
<a class="jxr_linenumber" name="209" href="#209">209</a>         <em class="jxr_comment">// Generate counts for each bit length</em>
<a class="jxr_linenumber" name="210" href="#210">210</a> 
<a class="jxr_linenumber" name="211" href="#211">211</a>         p = 0;
<a class="jxr_linenumber" name="212" href="#212">212</a>         i = n;
<a class="jxr_linenumber" name="213" href="#213">213</a>         <strong class="jxr_keyword">do</strong> {
<a class="jxr_linenumber" name="214" href="#214">214</a>             c[b[bindex + p]] ++;
<a class="jxr_linenumber" name="215" href="#215">215</a>             p ++;
<a class="jxr_linenumber" name="216" href="#216">216</a>             i --; <em class="jxr_comment">// assume all entries &lt;= BMAX</em>
<a class="jxr_linenumber" name="217" href="#217">217</a>         } <strong class="jxr_keyword">while</strong> (i != 0);
<a class="jxr_linenumber" name="218" href="#218">218</a> 
<a class="jxr_linenumber" name="219" href="#219">219</a>         <strong class="jxr_keyword">if</strong> (c[0] == n) { <em class="jxr_comment">// null input--all zero length codes</em>
<a class="jxr_linenumber" name="220" href="#220">220</a>             t[0] = -1;
<a class="jxr_linenumber" name="221" href="#221">221</a>             m[0] = 0;
<a class="jxr_linenumber" name="222" href="#222">222</a>             <strong class="jxr_keyword">return</strong> JZlib.Z_OK;
<a class="jxr_linenumber" name="223" href="#223">223</a>         }
<a class="jxr_linenumber" name="224" href="#224">224</a> 
<a class="jxr_linenumber" name="225" href="#225">225</a>         <em class="jxr_comment">// Find minimum and maximum length, bound *m by those</em>
<a class="jxr_linenumber" name="226" href="#226">226</a>         l = m[0];
<a class="jxr_linenumber" name="227" href="#227">227</a>         <strong class="jxr_keyword">for</strong> (j = 1; j &lt;= BMAX; j ++) {
<a class="jxr_linenumber" name="228" href="#228">228</a>             <strong class="jxr_keyword">if</strong> (c[j] != 0) {
<a class="jxr_linenumber" name="229" href="#229">229</a>                 <strong class="jxr_keyword">break</strong>;
<a class="jxr_linenumber" name="230" href="#230">230</a>             }
<a class="jxr_linenumber" name="231" href="#231">231</a>         }
<a class="jxr_linenumber" name="232" href="#232">232</a>         k = j; <em class="jxr_comment">// minimum code length</em>
<a class="jxr_linenumber" name="233" href="#233">233</a>         <strong class="jxr_keyword">if</strong> (l &lt; j) {
<a class="jxr_linenumber" name="234" href="#234">234</a>             l = j;
<a class="jxr_linenumber" name="235" href="#235">235</a>         }
<a class="jxr_linenumber" name="236" href="#236">236</a>         <strong class="jxr_keyword">for</strong> (i = BMAX; i != 0; i --) {
<a class="jxr_linenumber" name="237" href="#237">237</a>             <strong class="jxr_keyword">if</strong> (c[i] != 0) {
<a class="jxr_linenumber" name="238" href="#238">238</a>                 <strong class="jxr_keyword">break</strong>;
<a class="jxr_linenumber" name="239" href="#239">239</a>             }
<a class="jxr_linenumber" name="240" href="#240">240</a>         }
<a class="jxr_linenumber" name="241" href="#241">241</a>         g = i; <em class="jxr_comment">// maximum code length</em>
<a class="jxr_linenumber" name="242" href="#242">242</a>         <strong class="jxr_keyword">if</strong> (l &gt; i) {
<a class="jxr_linenumber" name="243" href="#243">243</a>             l = i;
<a class="jxr_linenumber" name="244" href="#244">244</a>         }
<a class="jxr_linenumber" name="245" href="#245">245</a>         m[0] = l;
<a class="jxr_linenumber" name="246" href="#246">246</a> 
<a class="jxr_linenumber" name="247" href="#247">247</a>         <em class="jxr_comment">// Adjust last length count to fill out codes, if needed</em>
<a class="jxr_linenumber" name="248" href="#248">248</a>         <strong class="jxr_keyword">for</strong> (y = 1 &lt;&lt; j; j &lt; i; j ++, y &lt;&lt;= 1) {
<a class="jxr_linenumber" name="249" href="#249">249</a>             <strong class="jxr_keyword">if</strong> ((y -= c[j]) &lt; 0) {
<a class="jxr_linenumber" name="250" href="#250">250</a>                 <strong class="jxr_keyword">return</strong> JZlib.Z_DATA_ERROR;
<a class="jxr_linenumber" name="251" href="#251">251</a>             }
<a class="jxr_linenumber" name="252" href="#252">252</a>         }
<a class="jxr_linenumber" name="253" href="#253">253</a>         <strong class="jxr_keyword">if</strong> ((y -= c[i]) &lt; 0) {
<a class="jxr_linenumber" name="254" href="#254">254</a>             <strong class="jxr_keyword">return</strong> JZlib.Z_DATA_ERROR;
<a class="jxr_linenumber" name="255" href="#255">255</a>         }
<a class="jxr_linenumber" name="256" href="#256">256</a>         c[i] += y;
<a class="jxr_linenumber" name="257" href="#257">257</a> 
<a class="jxr_linenumber" name="258" href="#258">258</a>         <em class="jxr_comment">// Generate starting offsets into the value table for each length</em>
<a class="jxr_linenumber" name="259" href="#259">259</a>         x[1] = j = 0;
<a class="jxr_linenumber" name="260" href="#260">260</a>         p = 1;
<a class="jxr_linenumber" name="261" href="#261">261</a>         xp = 2;
<a class="jxr_linenumber" name="262" href="#262">262</a>         <strong class="jxr_keyword">while</strong> (-- i != 0) { <em class="jxr_comment">// note that i == g from above</em>
<a class="jxr_linenumber" name="263" href="#263">263</a>             x[xp] = j += c[p];
<a class="jxr_linenumber" name="264" href="#264">264</a>             xp ++;
<a class="jxr_linenumber" name="265" href="#265">265</a>             p ++;
<a class="jxr_linenumber" name="266" href="#266">266</a>         }
<a class="jxr_linenumber" name="267" href="#267">267</a> 
<a class="jxr_linenumber" name="268" href="#268">268</a>         <em class="jxr_comment">// Make a table of values in order of bit lengths</em>
<a class="jxr_linenumber" name="269" href="#269">269</a>         i = 0;
<a class="jxr_linenumber" name="270" href="#270">270</a>         p = 0;
<a class="jxr_linenumber" name="271" href="#271">271</a>         <strong class="jxr_keyword">do</strong> {
<a class="jxr_linenumber" name="272" href="#272">272</a>             <strong class="jxr_keyword">if</strong> ((j = b[bindex + p]) != 0) {
<a class="jxr_linenumber" name="273" href="#273">273</a>                 v[x[j] ++] = i;
<a class="jxr_linenumber" name="274" href="#274">274</a>             }
<a class="jxr_linenumber" name="275" href="#275">275</a>             p ++;
<a class="jxr_linenumber" name="276" href="#276">276</a>         } <strong class="jxr_keyword">while</strong> (++ i &lt; n);
<a class="jxr_linenumber" name="277" href="#277">277</a>         n = x[g]; <em class="jxr_comment">// set n to length of v</em>
<a class="jxr_linenumber" name="278" href="#278">278</a> 
<a class="jxr_linenumber" name="279" href="#279">279</a>         <em class="jxr_comment">// Generate the Huffman codes and for each, make the table entries</em>
<a class="jxr_linenumber" name="280" href="#280">280</a>         x[0] = i = 0; <em class="jxr_comment">// first Huffman code is zero</em>
<a class="jxr_linenumber" name="281" href="#281">281</a>         p = 0; <em class="jxr_comment">// grab values in bit order</em>
<a class="jxr_linenumber" name="282" href="#282">282</a>         h = -1; <em class="jxr_comment">// no tables yet--level -1</em>
<a class="jxr_linenumber" name="283" href="#283">283</a>         w = -l; <em class="jxr_comment">// bits decoded == (l * h)</em>
<a class="jxr_linenumber" name="284" href="#284">284</a>         u[0] = 0; <em class="jxr_comment">// just to keep compilers happy</em>
<a class="jxr_linenumber" name="285" href="#285">285</a>         q = 0; <em class="jxr_comment">// ditto</em>
<a class="jxr_linenumber" name="286" href="#286">286</a>         z = 0; <em class="jxr_comment">// ditto</em>
<a class="jxr_linenumber" name="287" href="#287">287</a> 
<a class="jxr_linenumber" name="288" href="#288">288</a>         <em class="jxr_comment">// go through the bit lengths (k already is bits in shortest code)</em>
<a class="jxr_linenumber" name="289" href="#289">289</a>         <strong class="jxr_keyword">for</strong> (; k &lt;= g; k ++) {
<a class="jxr_linenumber" name="290" href="#290">290</a>             a = c[k];
<a class="jxr_linenumber" name="291" href="#291">291</a>             <strong class="jxr_keyword">while</strong> (a -- != 0) {
<a class="jxr_linenumber" name="292" href="#292">292</a>                 <em class="jxr_comment">// here i is the Huffman code of length k bits for value *p</em>
<a class="jxr_linenumber" name="293" href="#293">293</a>                 <em class="jxr_comment">// make tables up to required level</em>
<a class="jxr_linenumber" name="294" href="#294">294</a>                 <strong class="jxr_keyword">while</strong> (k &gt; w + l) {
<a class="jxr_linenumber" name="295" href="#295">295</a>                     h ++;
<a class="jxr_linenumber" name="296" href="#296">296</a>                     w += l; <em class="jxr_comment">// previous table always l bits</em>
<a class="jxr_linenumber" name="297" href="#297">297</a>                     <em class="jxr_comment">// compute minimum size table less than or equal to l bits</em>
<a class="jxr_linenumber" name="298" href="#298">298</a>                     z = g - w;
<a class="jxr_linenumber" name="299" href="#299">299</a>                     z = z &gt; l? l : z; <em class="jxr_comment">// table size upper limit</em>
<a class="jxr_linenumber" name="300" href="#300">300</a>                     <strong class="jxr_keyword">if</strong> ((f = 1 &lt;&lt; (j = k - w)) &gt; a + 1) { <em class="jxr_comment">// try a k-w bit table</em>
<a class="jxr_linenumber" name="301" href="#301">301</a>                         <em class="jxr_comment">// too few codes for k-w bit table</em>
<a class="jxr_linenumber" name="302" href="#302">302</a>                         f -= a + 1; <em class="jxr_comment">// deduct codes from patterns left</em>
<a class="jxr_linenumber" name="303" href="#303">303</a>                         xp = k;
<a class="jxr_linenumber" name="304" href="#304">304</a>                         <strong class="jxr_keyword">if</strong> (j &lt; z) {
<a class="jxr_linenumber" name="305" href="#305">305</a>                             <strong class="jxr_keyword">while</strong> (++ j &lt; z) { <em class="jxr_comment">// try smaller tables up to z bits</em>
<a class="jxr_linenumber" name="306" href="#306">306</a>                                 <strong class="jxr_keyword">if</strong> ((f &lt;&lt;= 1) &lt;= c[++ xp]) {
<a class="jxr_linenumber" name="307" href="#307">307</a>                                     <strong class="jxr_keyword">break</strong>; <em class="jxr_comment">// enough codes to use up j bits</em>
<a class="jxr_linenumber" name="308" href="#308">308</a>                                 }
<a class="jxr_linenumber" name="309" href="#309">309</a>                                 f -= c[xp]; <em class="jxr_comment">// else deduct codes from patterns</em>
<a class="jxr_linenumber" name="310" href="#310">310</a>                             }
<a class="jxr_linenumber" name="311" href="#311">311</a>                         }
<a class="jxr_linenumber" name="312" href="#312">312</a>                     }
<a class="jxr_linenumber" name="313" href="#313">313</a>                     z = 1 &lt;&lt; j; <em class="jxr_comment">// table entries for j-bit table</em>
<a class="jxr_linenumber" name="314" href="#314">314</a> 
<a class="jxr_linenumber" name="315" href="#315">315</a>                     <em class="jxr_comment">// allocate new table</em>
<a class="jxr_linenumber" name="316" href="#316">316</a>                     <strong class="jxr_keyword">if</strong> (hn[0] + z &gt; JZlib.MANY) { <em class="jxr_comment">// (note: doesn't matter for fixed)</em>
<a class="jxr_linenumber" name="317" href="#317">317</a>                         <strong class="jxr_keyword">return</strong> JZlib.Z_DATA_ERROR; <em class="jxr_comment">// overflow of MANY</em>
<a class="jxr_linenumber" name="318" href="#318">318</a>                     }
<a class="jxr_linenumber" name="319" href="#319">319</a>                     u[h] = q = <em class="jxr_comment">/*<em class="jxr_comment">hp+*/</em>hn[0]; <em class="jxr_comment">// DEBUG</em></em>
<a class="jxr_linenumber" name="320" href="#320">320</a>                     hn[0] += z;
<a class="jxr_linenumber" name="321" href="#321">321</a> 
<a class="jxr_linenumber" name="322" href="#322">322</a>                     <em class="jxr_comment">// connect to last table, if there is one</em>
<a class="jxr_linenumber" name="323" href="#323">323</a>                     <strong class="jxr_keyword">if</strong> (h != 0) {
<a class="jxr_linenumber" name="324" href="#324">324</a>                         x[h] = i; <em class="jxr_comment">// save pattern for backing up</em>
<a class="jxr_linenumber" name="325" href="#325">325</a>                         r[0] = (byte) j; <em class="jxr_comment">// bits in this table</em>
<a class="jxr_linenumber" name="326" href="#326">326</a>                         r[1] = (byte) l; <em class="jxr_comment">// bits to dump before this table</em>
<a class="jxr_linenumber" name="327" href="#327">327</a>                         j = i &gt;&gt;&gt; w - l;
<a class="jxr_linenumber" name="328" href="#328">328</a>                         r[2] = q - u[h - 1] - j; <em class="jxr_comment">// offset to this table</em>
<a class="jxr_linenumber" name="329" href="#329">329</a>                         System.arraycopy(r, 0, hp, (u[h - 1] + j) * 3, 3); <em class="jxr_comment">// connect to last table</em>
<a class="jxr_linenumber" name="330" href="#330">330</a>                     } <strong class="jxr_keyword">else</strong> {
<a class="jxr_linenumber" name="331" href="#331">331</a>                         t[0] = q; <em class="jxr_comment">// first table is returned result</em>
<a class="jxr_linenumber" name="332" href="#332">332</a>                     }
<a class="jxr_linenumber" name="333" href="#333">333</a>                 }
<a class="jxr_linenumber" name="334" href="#334">334</a> 
<a class="jxr_linenumber" name="335" href="#335">335</a>                 <em class="jxr_comment">// set up table entry in r</em>
<a class="jxr_linenumber" name="336" href="#336">336</a>                 r[1] = (byte) (k - w);
<a class="jxr_linenumber" name="337" href="#337">337</a>                 <strong class="jxr_keyword">if</strong> (p &gt;= n) {
<a class="jxr_linenumber" name="338" href="#338">338</a>                     r[0] = 128 + 64; <em class="jxr_comment">// out of values--invalid code</em>
<a class="jxr_linenumber" name="339" href="#339">339</a>                 } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (v[p] &lt; s) {
<a class="jxr_linenumber" name="340" href="#340">340</a>                     r[0] = (byte) (v[p] &lt; 256? 0 : 32 + 64); <em class="jxr_comment">// 256 is end-of-block</em>
<a class="jxr_linenumber" name="341" href="#341">341</a>                     r[2] = v[p ++]; <em class="jxr_comment">// simple code is just the value</em>
<a class="jxr_linenumber" name="342" href="#342">342</a>                 } <strong class="jxr_keyword">else</strong> {
<a class="jxr_linenumber" name="343" href="#343">343</a>                     r[0] = (byte) (e[v[p] - s] + 16 + 64); <em class="jxr_comment">// non-simple--look up in lists</em>
<a class="jxr_linenumber" name="344" href="#344">344</a>                     r[2] = d[v[p ++] - s];
<a class="jxr_linenumber" name="345" href="#345">345</a>                 }
<a class="jxr_linenumber" name="346" href="#346">346</a> 
<a class="jxr_linenumber" name="347" href="#347">347</a>                 <em class="jxr_comment">// fill code-like entries with r</em>
<a class="jxr_linenumber" name="348" href="#348">348</a>                 f = 1 &lt;&lt; k - w;
<a class="jxr_linenumber" name="349" href="#349">349</a>                 <strong class="jxr_keyword">for</strong> (j = i &gt;&gt;&gt; w; j &lt; z; j += f) {
<a class="jxr_linenumber" name="350" href="#350">350</a>                     System.arraycopy(r, 0, hp, (q + j) * 3, 3);
<a class="jxr_linenumber" name="351" href="#351">351</a>                 }
<a class="jxr_linenumber" name="352" href="#352">352</a> 
<a class="jxr_linenumber" name="353" href="#353">353</a>                 <em class="jxr_comment">// backwards increment the k-bit code i</em>
<a class="jxr_linenumber" name="354" href="#354">354</a>                 <strong class="jxr_keyword">for</strong> (j = 1 &lt;&lt; k - 1; (i &amp; j) != 0; j &gt;&gt;&gt;= 1) {
<a class="jxr_linenumber" name="355" href="#355">355</a>                     i ^= j;
<a class="jxr_linenumber" name="356" href="#356">356</a>                 }
<a class="jxr_linenumber" name="357" href="#357">357</a>                 i ^= j;
<a class="jxr_linenumber" name="358" href="#358">358</a> 
<a class="jxr_linenumber" name="359" href="#359">359</a>                 <em class="jxr_comment">// backup over finished tables</em>
<a class="jxr_linenumber" name="360" href="#360">360</a>                 mask = (1 &lt;&lt; w) - 1; <em class="jxr_comment">// needed on HP, cc -O bug</em>
<a class="jxr_linenumber" name="361" href="#361">361</a>                 <strong class="jxr_keyword">while</strong> ((i &amp; mask) != x[h]) {
<a class="jxr_linenumber" name="362" href="#362">362</a>                     h --; <em class="jxr_comment">// don't need to update q</em>
<a class="jxr_linenumber" name="363" href="#363">363</a>                     w -= l;
<a class="jxr_linenumber" name="364" href="#364">364</a>                     mask = (1 &lt;&lt; w) - 1;
<a class="jxr_linenumber" name="365" href="#365">365</a>                 }
<a class="jxr_linenumber" name="366" href="#366">366</a>             }
<a class="jxr_linenumber" name="367" href="#367">367</a>         }
<a class="jxr_linenumber" name="368" href="#368">368</a>         <em class="jxr_comment">// Return Z_BUF_ERROR if we were given an incomplete table</em>
<a class="jxr_linenumber" name="369" href="#369">369</a>         <strong class="jxr_keyword">return</strong> y != 0 &amp;&amp; g != 1? JZlib.Z_BUF_ERROR : JZlib.Z_OK;
<a class="jxr_linenumber" name="370" href="#370">370</a>     }
<a class="jxr_linenumber" name="371" href="#371">371</a> 
<a class="jxr_linenumber" name="372" href="#372">372</a>     <strong class="jxr_keyword">int</strong> inflate_trees_bits(<strong class="jxr_keyword">int</strong>[] c, <em class="jxr_comment">// 19 code lengths</em>
<a class="jxr_linenumber" name="373" href="#373">373</a>             <strong class="jxr_keyword">int</strong>[] bb, <em class="jxr_comment">// bits tree desired/actual depth</em>
<a class="jxr_linenumber" name="374" href="#374">374</a>             <strong class="jxr_keyword">int</strong>[] tb, <em class="jxr_comment">// bits tree result</em>
<a class="jxr_linenumber" name="375" href="#375">375</a>             <strong class="jxr_keyword">int</strong>[] hp, <em class="jxr_comment">// space for trees</em>
<a class="jxr_linenumber" name="376" href="#376">376</a>             <a href="../../../../../../org/jboss/netty/util/internal/jzlib/ZStream.html">ZStream</a> z <em class="jxr_comment">// for messages</em>
<a class="jxr_linenumber" name="377" href="#377">377</a>     ) {
<a class="jxr_linenumber" name="378" href="#378">378</a>         <strong class="jxr_keyword">int</strong> result;
<a class="jxr_linenumber" name="379" href="#379">379</a>         initWorkArea(19);
<a class="jxr_linenumber" name="380" href="#380">380</a>         hn[0] = 0;
<a class="jxr_linenumber" name="381" href="#381">381</a>         result = huft_build(c, 0, 19, 19, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, tb, bb, hp, hn, v);
<a class="jxr_linenumber" name="382" href="#382">382</a> 
<a class="jxr_linenumber" name="383" href="#383">383</a>         <strong class="jxr_keyword">if</strong> (result == JZlib.Z_DATA_ERROR) {
<a class="jxr_linenumber" name="384" href="#384">384</a>             z.msg = <span class="jxr_string">"oversubscribed dynamic bit lengths tree"</span>;
<a class="jxr_linenumber" name="385" href="#385">385</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (result == JZlib.Z_BUF_ERROR || bb[0] == 0) {
<a class="jxr_linenumber" name="386" href="#386">386</a>             z.msg = <span class="jxr_string">"incomplete dynamic bit lengths tree"</span>;
<a class="jxr_linenumber" name="387" href="#387">387</a>             result = JZlib.Z_DATA_ERROR;
<a class="jxr_linenumber" name="388" href="#388">388</a>         }
<a class="jxr_linenumber" name="389" href="#389">389</a>         <strong class="jxr_keyword">return</strong> result;
<a class="jxr_linenumber" name="390" href="#390">390</a>     }
<a class="jxr_linenumber" name="391" href="#391">391</a> 
<a class="jxr_linenumber" name="392" href="#392">392</a>     <strong class="jxr_keyword">int</strong> inflate_trees_dynamic(<strong class="jxr_keyword">int</strong> nl, <em class="jxr_comment">// number of literal/length codes</em>
<a class="jxr_linenumber" name="393" href="#393">393</a>             <strong class="jxr_keyword">int</strong> nd, <em class="jxr_comment">// number of distance codes</em>
<a class="jxr_linenumber" name="394" href="#394">394</a>             <strong class="jxr_keyword">int</strong>[] c, <em class="jxr_comment">// that many (total) code lengths</em>
<a class="jxr_linenumber" name="395" href="#395">395</a>             <strong class="jxr_keyword">int</strong>[] bl, <em class="jxr_comment">// literal desired/actual bit depth</em>
<a class="jxr_linenumber" name="396" href="#396">396</a>             <strong class="jxr_keyword">int</strong>[] bd, <em class="jxr_comment">// distance desired/actual bit depth</em>
<a class="jxr_linenumber" name="397" href="#397">397</a>             <strong class="jxr_keyword">int</strong>[] tl, <em class="jxr_comment">// literal/length tree result</em>
<a class="jxr_linenumber" name="398" href="#398">398</a>             <strong class="jxr_keyword">int</strong>[] td, <em class="jxr_comment">// distance tree result</em>
<a class="jxr_linenumber" name="399" href="#399">399</a>             <strong class="jxr_keyword">int</strong>[] hp, <em class="jxr_comment">// space for trees</em>
<a class="jxr_linenumber" name="400" href="#400">400</a>             <a href="../../../../../../org/jboss/netty/util/internal/jzlib/ZStream.html">ZStream</a> z <em class="jxr_comment">// for messages</em>
<a class="jxr_linenumber" name="401" href="#401">401</a>     ) {
<a class="jxr_linenumber" name="402" href="#402">402</a>         <strong class="jxr_keyword">int</strong> result;
<a class="jxr_linenumber" name="403" href="#403">403</a> 
<a class="jxr_linenumber" name="404" href="#404">404</a>         <em class="jxr_comment">// build literal/length tree</em>
<a class="jxr_linenumber" name="405" href="#405">405</a>         initWorkArea(288);
<a class="jxr_linenumber" name="406" href="#406">406</a>         hn[0] = 0;
<a class="jxr_linenumber" name="407" href="#407">407</a>         result = huft_build(c, 0, nl, 257, cplens, cplext, tl, bl, hp, hn, v);
<a class="jxr_linenumber" name="408" href="#408">408</a>         <strong class="jxr_keyword">if</strong> (result != JZlib.Z_OK || bl[0] == 0) {
<a class="jxr_linenumber" name="409" href="#409">409</a>             <strong class="jxr_keyword">if</strong> (result == JZlib.Z_DATA_ERROR) {
<a class="jxr_linenumber" name="410" href="#410">410</a>                 z.msg = <span class="jxr_string">"oversubscribed literal/length tree"</span>;
<a class="jxr_linenumber" name="411" href="#411">411</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (result != JZlib.Z_MEM_ERROR) {
<a class="jxr_linenumber" name="412" href="#412">412</a>                 z.msg = <span class="jxr_string">"incomplete literal/length tree"</span>;
<a class="jxr_linenumber" name="413" href="#413">413</a>                 result = JZlib.Z_DATA_ERROR;
<a class="jxr_linenumber" name="414" href="#414">414</a>             }
<a class="jxr_linenumber" name="415" href="#415">415</a>             <strong class="jxr_keyword">return</strong> result;
<a class="jxr_linenumber" name="416" href="#416">416</a>         }
<a class="jxr_linenumber" name="417" href="#417">417</a> 
<a class="jxr_linenumber" name="418" href="#418">418</a>         <em class="jxr_comment">// build distance tree</em>
<a class="jxr_linenumber" name="419" href="#419">419</a>         initWorkArea(288);
<a class="jxr_linenumber" name="420" href="#420">420</a>         result = huft_build(c, nl, nd, 0, cpdist, cpdext, td, bd, hp, hn, v);
<a class="jxr_linenumber" name="421" href="#421">421</a> 
<a class="jxr_linenumber" name="422" href="#422">422</a>         <strong class="jxr_keyword">if</strong> (result != JZlib.Z_OK || bd[0] == 0 &amp;&amp; nl &gt; 257) {
<a class="jxr_linenumber" name="423" href="#423">423</a>             <strong class="jxr_keyword">if</strong> (result == JZlib.Z_DATA_ERROR) {
<a class="jxr_linenumber" name="424" href="#424">424</a>                 z.msg = <span class="jxr_string">"oversubscribed distance tree"</span>;
<a class="jxr_linenumber" name="425" href="#425">425</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (result == JZlib.Z_BUF_ERROR) {
<a class="jxr_linenumber" name="426" href="#426">426</a>                 z.msg = <span class="jxr_string">"incomplete distance tree"</span>;
<a class="jxr_linenumber" name="427" href="#427">427</a>                 result = JZlib.Z_DATA_ERROR;
<a class="jxr_linenumber" name="428" href="#428">428</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (result != JZlib.Z_MEM_ERROR) {
<a class="jxr_linenumber" name="429" href="#429">429</a>                 z.msg = <span class="jxr_string">"empty distance tree with lengths"</span>;
<a class="jxr_linenumber" name="430" href="#430">430</a>                 result = JZlib.Z_DATA_ERROR;
<a class="jxr_linenumber" name="431" href="#431">431</a>             }
<a class="jxr_linenumber" name="432" href="#432">432</a>             <strong class="jxr_keyword">return</strong> result;
<a class="jxr_linenumber" name="433" href="#433">433</a>         }
<a class="jxr_linenumber" name="434" href="#434">434</a> 
<a class="jxr_linenumber" name="435" href="#435">435</a>         <strong class="jxr_keyword">return</strong> JZlib.Z_OK;
<a class="jxr_linenumber" name="436" href="#436">436</a>     }
<a class="jxr_linenumber" name="437" href="#437">437</a> 
<a class="jxr_linenumber" name="438" href="#438">438</a>     <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">int</strong> inflate_trees_fixed(<strong class="jxr_keyword">int</strong>[] bl, <em class="jxr_comment">//literal desired/actual bit depth</em>
<a class="jxr_linenumber" name="439" href="#439">439</a>             <strong class="jxr_keyword">int</strong>[] bd, <em class="jxr_comment">//distance desired/actual bit depth</em>
<a class="jxr_linenumber" name="440" href="#440">440</a>             <strong class="jxr_keyword">int</strong>[][] tl, <em class="jxr_comment">//literal/length tree result</em>
<a class="jxr_linenumber" name="441" href="#441">441</a>             <strong class="jxr_keyword">int</strong>[][] td <em class="jxr_comment">//distance tree result</em>
<a class="jxr_linenumber" name="442" href="#442">442</a>     ) {
<a class="jxr_linenumber" name="443" href="#443">443</a>         bl[0] = fixed_bl;
<a class="jxr_linenumber" name="444" href="#444">444</a>         bd[0] = fixed_bd;
<a class="jxr_linenumber" name="445" href="#445">445</a>         tl[0] = fixed_tl;
<a class="jxr_linenumber" name="446" href="#446">446</a>         td[0] = fixed_td;
<a class="jxr_linenumber" name="447" href="#447">447</a>         <strong class="jxr_keyword">return</strong> JZlib.Z_OK;
<a class="jxr_linenumber" name="448" href="#448">448</a>     }
<a class="jxr_linenumber" name="449" href="#449">449</a> 
<a class="jxr_linenumber" name="450" href="#450">450</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> initWorkArea(<strong class="jxr_keyword">int</strong> vsize) {
<a class="jxr_linenumber" name="451" href="#451">451</a>         <strong class="jxr_keyword">if</strong> (hn == <strong class="jxr_keyword">null</strong>) {
<a class="jxr_linenumber" name="452" href="#452">452</a>             hn = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[1];
<a class="jxr_linenumber" name="453" href="#453">453</a>             v = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[vsize];
<a class="jxr_linenumber" name="454" href="#454">454</a>             c = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[BMAX + 1];
<a class="jxr_linenumber" name="455" href="#455">455</a>             r = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[3];
<a class="jxr_linenumber" name="456" href="#456">456</a>             u = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[BMAX];
<a class="jxr_linenumber" name="457" href="#457">457</a>             x = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[BMAX + 1];
<a class="jxr_linenumber" name="458" href="#458">458</a>         } <strong class="jxr_keyword">else</strong> {
<a class="jxr_linenumber" name="459" href="#459">459</a>             <strong class="jxr_keyword">if</strong> (v.length &lt; vsize) {
<a class="jxr_linenumber" name="460" href="#460">460</a>                 v = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[vsize];
<a class="jxr_linenumber" name="461" href="#461">461</a>             } <strong class="jxr_keyword">else</strong> {
<a class="jxr_linenumber" name="462" href="#462">462</a>                 <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; vsize; i ++) {
<a class="jxr_linenumber" name="463" href="#463">463</a>                     v[i] = 0;
<a class="jxr_linenumber" name="464" href="#464">464</a>                 }
<a class="jxr_linenumber" name="465" href="#465">465</a>             }
<a class="jxr_linenumber" name="466" href="#466">466</a>             <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; BMAX + 1; i ++) {
<a class="jxr_linenumber" name="467" href="#467">467</a>                 c[i] = 0;
<a class="jxr_linenumber" name="468" href="#468">468</a>             }
<a class="jxr_linenumber" name="469" href="#469">469</a>             <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; 3; i ++) {
<a class="jxr_linenumber" name="470" href="#470">470</a>                 r[i] = 0;
<a class="jxr_linenumber" name="471" href="#471">471</a>             }
<a class="jxr_linenumber" name="472" href="#472">472</a>             <em class="jxr_comment">//  for(int i=0; i&lt;BMAX; i++){u[i]=0;}</em>
<a class="jxr_linenumber" name="473" href="#473">473</a>             System.arraycopy(c, 0, u, 0, BMAX);
<a class="jxr_linenumber" name="474" href="#474">474</a>             <em class="jxr_comment">//  for(int i=0; i&lt;BMAX+1; i++){x[i]=0;}</em>
<a class="jxr_linenumber" name="475" href="#475">475</a>             System.arraycopy(c, 0, x, 0, BMAX + 1);
<a class="jxr_linenumber" name="476" href="#476">476</a>         }
<a class="jxr_linenumber" name="477" href="#477">477</a>     }
<a class="jxr_linenumber" name="478" href="#478">478</a> }
</pre>
<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
</html>

